package com.lkd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lkd.dto.NodeQueryDTO;
import com.lkd.entity.Node;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NodeMapper extends BaseMapper<Node> {
    /**
     * 获取点位列表
     */
    List<Node> selectNodeVoList(NodeQueryDTO node);

    /**
     * 获取点位数量
     */
    @Select("select count(1) nodeCount from tb_node where region_id = #{id}")
    Integer getNodeCount(String id);

    /**
     * 添加点位
     */
    boolean insertNode(Node node);

    /**
     * 修改点位
     */
    boolean updateNode(Node node);

    /**
     * 删除点位
     */
    @Delete("delete from tb_node where id = #{nodeId}")
    boolean delNode(String nodeId);

    /**
     * 获取点位详情
     */
    @Select("select * from tb_node where id = #{nodeId}")
    Node getByNodeId(String nodeId);

    List<String> nameList();

    Integer getNodeCountByName(String name);
}
